//#define NO_FLOAT
#define __samp03 2
#include <a_samp>

#include <myfuncsdll>


#define cellbytes (cellbits/8)

main()
{
	new n = 15;

	printf("0x%x", myaddr_local(n));


	new n_ptr = myaddr_global(n); // int *n_ptr = &n

	printf("0x%x", n_ptr);
	printf("%d", mypeek(n_ptr)); // *n_ptr

	mypoke(n_ptr, 126); // *n_ptr = 126
	printf("%d", n);


	print("---");

	new bef = 151;
	new s[16];
	new aft = 252;
	#pragma unused bef, aft

	new s_ptr = myaddr_global(s[0]); // int *s_ptr = &s[0]

	for(new i = 0; i < 16; i++)
		mypoke(s_ptr + i * cellbytes, i * 10); // s[i] = i * 10


	for(new i = 0; i < 16; i++)
		printf("%d", mypeek(s_ptr + i * cellbytes)); // s[i]

	printf("%d, %d", mypeek(s_ptr - cellbytes), mypeek(s_ptr + 16 * cellbytes)); // s[-1], s[16]

	print("---");

	new Float:f = 3.141592, n2 = 12345;
	//#pragma unused n2


	new f_ptr = myaddr_global(f);

	mypoke(f_ptr, 3.14);

	printf("%.6f, %d", mypeek(f_ptr),
		mypeek(f_ptr - cellbytes)); // hacking n2

	mypoke(f_ptr - cellbytes, 54321);

	printf("%d", n2);

	return 0;
}

/*
0x40A4
0x16AADA4
15
126
---
0
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
252, 151
---
3.141592, 12345
54321
*/

